<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Products</title>
<script src="js/common/submitform.js" type="text/javascript"></script>
<style type="text/css">
.even {
	background-color: silver;
}
table th {
    float: left;
    padding: 1%;
    text-align: left;
    width: 10% !important;
}
table td {
    float: left;
    padding: 1%;
    text-align: left;
    width: 10% !important;
}
</style>

</head>
<body>
<div  style="padding: 50px;">
<c:if test="${fn:length(items)> 0}">
	<table>
		<tr class="even">
			<th>&nbsp;</th>
			<th>Product Name</th>
			<th>Product Type</th>
			<th>Category</th>
			<th>Taste</th>
			<th>Price</th>
			<th>&nbsp;</th>
			<th>&nbsp;</th>
		</tr>
		<c:forEach items="${items}" var="item" varStatus="status">
			<tr class="<c:if test="${status.count % 2 == 0}">even</c:if>">
				<td>${status.count}</td>
				<td title="${item.description}"> 
					<a href="${item.editAction}">${item.name}</a>
				</td>
				<td>${item.category}</td>
				<td>${item.itemClass}</td>
				<td>${item.taste}</td>
				<td>${item.price}</td>
				<td>
					<a href="${item.editAction}">edit</a>
				</td>
				<td>
					<a href="${item.deleteAction}">delete</a>
				</td>
			</tr>
		</c:forEach>
	</table>
</c:if>

<div style="padding-top:  20px;">
		
		<input name="addProduct" class="btTxt submit" type="button" value="Add New Product" onclick="submitUrl('addProduct.action?id=');"/>
</div>
</div>
</body>
</html>